package pl.edu.pw.ee.buildcity.domain;

import org.apache.commons.lang.time.DateUtils;
import org.junit.Test;
import pl.edu.pw.ee.buildcity.entities.BuildActivity;

import java.util.Date;

/**
 * @author Mateusz
 * @since 2010-04-05
 */
public class BuildActivityTestCase {

	@Test
	public void shouldReturnDuration() {
		//Given
		BuildActivity ba = new BuildActivity();
		Date now = new Date();
		Date ended = DateUtils.addHours(now, -1);
		ended = DateUtils.addDays(ended, -2);
		ended = DateUtils.addMinutes(ended, -2);
		ba.ended(ended);

		//When
		String interval = ba.getEndedInterval();

		//Then
		System.out.println("interval: " + interval);


	}


	@Test
	public void shouldReturnDuration2() {
		//Given
		BuildActivity ba = new BuildActivity();
		Date now = new Date();
		ba.ended(now);

		//When
		String interval = ba.getEndedInterval();

		//Then
		System.out.println("interval: " + interval);

	}

	@Test
	public void should() {
		//Given
		Date now = new Date();
		Date started = new Date();
		started = DateUtils.addMilliseconds(now, -24);

		BuildActivity ba = new BuildActivity().ended(now).started(started);

		//When
		String duration = ba.getDuration();

		//Then
		System.out.println("duration: " + duration);

	}


}
